package adke.models.powerups.property;

import adke.Util;
import adke.managers.GamePowerupManager;
import adke.models.powerups.PropertyPowerup;

// verandert hole frequency, of hole lengtes

public class HolePowerup extends PropertyPowerup
{
    public HolePowerup()
    {
        super();
    }

    public void activate()
    {
        if (ACTIVATED) return;
        ACTIVATED = true;
        
        // gooi muntje op
        int option = Util.random(2);
        
        // frequency
        if (option == 0)
        {
            // snelheidsdeviatie die we gaan randomizen
            int deviation = GamePowerupManager.getHoleFrequencyDeviation();
            int curSpeed = owner.getLine().getHoleFrequency();

            int newSpeed = curSpeed;

            switch (EFFECT)
            {
                case PropertyPowerup.NEGATIVE_PROPERTY:
                {
                    newSpeed = curSpeed - Util.random(deviation);
                }

                case PropertyPowerup.POSITIVE_PROPERTY:
                {
                    newSpeed = curSpeed + Util.random(deviation);
                }
            }

            owner.getLine().setHoleFrequency(newSpeed);
        }
        
        // lengte
        else
        {
            // snelheidsdeviatie die we gaan randomizen
            int deviation = GamePowerupManager.getHoleLengthDeviation();
            int curSpeed = owner.getLine().getHoleLength();

            int newSpeed = curSpeed;

//            switch (EFFECT)
            {
//                case PropertyPowerup.NEGATIVE_PROPERTY:
//                {
//                    newSpeed = curSpeed - Util.random(deviation);
//                }

//                case PropertyPowerup.POSITIVE_PROPERTY:
                {
                    newSpeed = curSpeed + Util.random(deviation);
                }
            }

            owner.getLine().setHoleLength(newSpeed);
        }
    }
}
